    var result=true;
    var reg = /^[a-z]\w+$/;
    var regEmail=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
    function ruleUn()
    {
        var un=document.getElementById("txtUserName").value;
        if(un=="")
        {
            document.getElementById("sUn").innerHTML="*4～16个字符,包括数字、英文字母、下划线";
            document.getElementById("sUn").style.color="#ff0000";
        }
    }
    function detectionUn()
    {
        var un=document.getElementById("txtUserName").value;
        if(un!="")
        {
            if(un.length<4)
            {
                document.getElementById("sUn").innerHTML="用户名长度不够4位数!";
                document.getElementById("sUn").style.color="#ff0000";
                result=false;
            }
            else if (!reg.test(un))
            { 
                document.getElementById("sUn").innerHTML="用户名只能由数字、英文字母和下划线组成";
                document.getElementById("sUn").style.color="#ff0000";
                result=false;
            } 
            else
            {
                var a=BLL.UserManager.DetectionUser(un).value;
                if(a)
                {
                    document.getElementById("sUn").innerHTML="恭喜您,该用户名可以注册!";
                    document.getElementById("sUn").style.color="#339933";
                }
                else
                {
                    document.getElementById("sUn").innerHTML="该用户名已被使用,请输入新的用户名!";
                    document.getElementById("sUn").style.color="#ff0000";
                    result=false;
                }
            }
        }
        else
        {
            document.getElementById("sUn").innerHTML="请输入用户名!";
            document.getElementById("sUn").style.color="#ff0000";
            result=false;
        }
    }
    function rulePwd()
    {
        var pwd=document.getElementById("txtPwd").value;
        if(pwd=="")
        {
            document.getElementById("sPwd").innerHTML="*6～16个字符,包括字母、数字、特殊符号!";
            document.getElementById("sPwd").style.color="#ff0000";
        }
    }
    function detectionPwd()
    {
        var pwd=document.getElementById("txtPwd").value;
        if(pwd!="")
        {
            if(pwd.length<6)
            {
                document.getElementById("sPwd").innerHTML="密码长度不够6位数!";
                document.getElementById("sPwd").style.color="#ff0000";
                result=false;
            }
            else
            {
                document.getElementById("sPwd").innerHTML="密码可以使用!";
                document.getElementById("sPwd").style.color="#339933";
            }
        }
        else
        {
            document.getElementById("sPwd").innerHTML="请输入密码!";
            document.getElementById("sPwd").style.color="#ff0000";
            result=false;
        }
    }
    function detectionAPwd()
    {
        var aPwd=document.getElementById("txtAgainPwd").value;
        if(aPwd=="")
        {
            document.getElementById("sAPwd").innerHTML="请输入确认密码!";
            document.getElementById("sAPwd").style.color="#ff0000";
            result=false;
        }
        else if(aPwd!=""&&aPwd!=document.getElementById("txtPwd").value)
        {
            document.getElementById("sAPwd").innerHTML="确认密码不一致!";
            document.getElementById("sAPwd").style.color="#ff0000";
            result=false;
        }
        else
        {
            document.getElementById("sAPwd").innerHTML="密码一致!";
            document.getElementById("sAPwd").style.color="#339933";
        }
    }
    function detectionEmail()
    {
        var email=document.getElementById("txtEmail").value;
        if(email=="")
        {
            document.getElementById("sEmail").innerHTML="请输入电子邮箱!";
            document.getElementById("sEmail").style.color="#ff0000";
            result=false;
        }
        else if(email!=""&&!regEmail.test(email))
        {
            document.getElementById("sEmail").innerHTML="电子邮箱格式不正确,请重新输入!";
            document.getElementById("sEmail").style.color="#ff0000";
            result=false;
        }
        else
        {
            document.getElementById("sEmail").innerHTML="电子邮箱格式正确!";
            document.getElementById("sEmail").style.color="#339933";
        }
    }
    function detectionCode()
    {
        var code=document.getElementById("txtCode").value;
        if(code=="")
        {
            document.getElementById("sCode").innerHTML="请输入验证码!";
            document.getElementById("sCode").style.color="#ff0000";
            result=false;
        }
        else
            document.getElementById("sCode").innerHTML="";
    }
    function register()
    {
        result=true;
        detectionUn();
        detectionPwd();
        detectionAPwd();
        detectionEmail();
        detectionCode();
        if(!document.getElementById("checkbox").checked)
            result=false;
        return result;
    }